package seekting.demo2017.activity;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

import com.google.gson.Gson;
import com.seekting.demo_lib.Demo;

import seekting.demo2017.AppEnv;

/**
 * Created by seekting on 17-5-18.
 */
@Demo(title = "GsonActivity", desc = "")
public class GsonActivity extends Activity {

    public static final boolean DEBUG = AppEnv.bAppdebug;
    public static final String TAG = GsonActivity.class.getSimpleName();


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (DEBUG) {
            Log.d(TAG, "onCreate.");
        }
        Gson gson = new Gson();
        Person person = new Person("jack", true, 20);
        String t = gson.toJson(person);
        Log.d("seekting", "GsonActivity.onCreate()" + t);


    }

    static class Person {
        String name;
        boolean isMan;
        int age;

        public Person(String name, boolean isMan, int age) {
            this.name = name;
            this.isMan = isMan;
            this.age = age;
        }
    }
}
